<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id="target"><span id="last"></span></div>
<script>
test(() => {
  var events = [];
  function recordEvent(event) {
    events.push(event.type);
  }
  var target = document.getElementById('target');
  var last = document.getElementById('last')
  target.addEventListener('DOMSubtreeModified', recordEvent, false);
  target.replaceChild(document.createDocumentFragment(), last);
  assert_array_equals(events, ['DOMSubtreeModified']);
}, 'replaceChild with an empty DocumentFragment should not dispatch two DOMSubtreeModified events.')
</script>
